public class Draw {

    public int Height;

    public void DrawTriangle() {
        // 绘制三角形
        if(Height < 3) {
            System.out.println("高度小于3,退出");
            return;
        }
        for(int i = 1;i <= Height;i++) {
            for(int j = 0;j < Height - i;j++) {
                System.out.print("\s");
            }
            for(int k = 0;k < (2 * i - 1);k++) {
                System.out.print("*");
            }
            System.out.print("\n");
        }
    }

    public void DrawParr() {
        // 绘制平行四边形
        if(Height < 3) {
            System.out.println("高度小于3,退出");
            return;
        }
        for(int i = 1;i <= Height;i++) {
            for(int j = 1;j < i;j++) {
                System.out.print("\s");
            }
            System.out.print("********\n");
        }
    }

    public void DrawRectangle() {
        // 绘制矩形
        if(Height < 3) {
            System.out.println("高度小于3,退出");
            return;
        }
        for(int i = 1;i <= Height;i++) {
            System.out.println("*********");
        }
    }

    public void DrawSquare() {
        // 绘制正方形
        if(Height < 3) {
            System.out.println("高度小于3,退出");
            return;
        }
        for(int i = 1;i <= Height;i++) {
            for(int j = 1;j <= Height;j++) {
                System.out.print("*\s");
            }
            System.out.print("\n");
        }
    }

    public static void main(String[] args) {
        Draw drawTri = new Draw();
        drawTri.Height = 4;
        drawTri.DrawParr(); 
        System.out.println("-----------------------");

        drawTri.DrawSquare();
        System.out.println("-----------------------");

        drawTri.DrawRectangle();
        System.out.println("-----------------------");
        drawTri.DrawTriangle();
    }
}
